<?php
	$fields_arr = array(
		'title'=>'标题',
		'cate'=>'分类',
		'addtime'=>'添加时间',
		'url'=>'网址',
		'logo'=>'LOGO',
		'listorder'=>'排序',
		'status'=>'状态',
		'operation'=>'操作',
	);
	if(!$custom_field_arr){
		$custom_field_arr = array_flip($fields_arr);
	}
	$fields_arr_new = array_merge($custom_field_arr,array_flip($fields_arr));
	$fields_arr_new = array_unique($fields_arr_new);
?>
{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}
<link rel="stylesheet" href="/res/js/framework/nestable/nestable.css">
<div class="container-fluid content-body">
	<div class="main">
		<!-- left side start-->

		<section class="left-section">
			<dl id="leftNav" data-type="message">
				<dt><i class="glyphicon glyphicon-plus"></i> 信息管理</dt>
				{if in_case_array('admin/notice',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/notice/index}">公告管理</a></dd>
				{/if}
				{if in_case_array('admin/information',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/information/index}">资讯管理</a></dd>
				{/if}
				{if in_case_array('admin/singlepage',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/singlepage/index}">单页管理</a></dd>
				{/if}
				{if in_case_array('admin/brand',$priv) || empty($priv)}
				<dd><a class="mb active" href="{url /admin/brand/index}">特约品牌</a></dd>
				{/if}
				{if in_case_array('admin/adPlace',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/adPlace/index}">广告位管理</a></dd>
				{/if}
				{if in_case_array('admin/ad',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/ad/index}">广告管理</a></dd>
				{/if}
			</dl>
		</section>

		<!-- left side end-->


		<!-- main content start-->
		<section class="right-section" id="right-section">
			{include admin.inc.bread}
			<h2 class="header">特约品牌列表</h2>
			<!-- start of inner-frame -->
			<div class="inner-iframe">

				<div class="inner-container">
					<form class="form-inline search-form" role="form">
						<nav class="inline-form clearfix">
							<a class="btnlg mb" href="{$add_url}"><i class="css-add"></i>添加特约品牌</a>
							<div class="r">
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											标题
										</div>
										<input type="text" class="form-control input-sm" maxlength="50" placeholder="标题" name="s_title" value="{$s_title}">
									</div>
								</div>

								<!-- searchselectscript -->
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											货品类型
										</div>
										<div class="css-select">
											<div class="chosen">
												<span></span>
												<i class="angle-down"></i>
												<input type="hidden" name="s_cate" value="{$s_cate}">
											</div>
											<ul>
												<li data-value="">-- 请选择 --</li>
												{loop $cates $v}
												<li data-value="{$v[cate]}">{$v[cate]}</li>
												{/loop}
											</ul>
										</div>
									</div>
								</div>

								<!-- searchselectscript -->
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											状态
										</div>
										<div class="css-select">
											<div class="chosen">
												<span></span>
												<i class="angle-down"></i>
												<input type="hidden" name="s_status" value="{$s_status}">
											</div>
											<ul>
												<li data-value="">-- 请选择 --</li>
												<li data-value="0">禁用</li>
												<li data-value="1">启用</li>
											</ul>
										</div>
									</div>
								</div>

								<!-- searchdatetime -->
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											添加时间
										</div>
										<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											   name="s_s_addtime" value="{$s_s_addtime}"
											   placeholder="开始添加时间" />

										<div class="input-group-addon">
											-
										</div>
										<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											   name="s_e_addtime" value="{$s_e_addtime}"
											   placeholder="结束添加时间" />
									</div>
								</div>

								<input type="hidden" name="order" value="{$order}">
								<button type="submit" class="btnlg mb">搜索</button>
								<input type="hidden" name="pagesize" value="{$pagesize}" >
								<button type="button" class="btnlg mb" id="defined">配置列表项</button>
							</div>
						</nav>

					</form>
					<form id="J_List_Form">
						<div class="table-responsive">
							<table id="J_ListTable" class="table  table-hover  table-striped">
								<!--tmpl-listtable-->

								<!-- listblock -->
								<thead>
									<tr>
										<th width="20">
											<label class="css-checkbox">
												<input type="checkbox" class="check-all">
												<span></span>
											</label>
										</th>
										{loop $custom_field_arr $k $v}
										<th>{$fields_arr[$v]}</th>
										{/loop}
									</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td style="text-align:center;" colspan="10" class="empty-table-td">{$emptyRecord}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td>
										<label class="css-checkbox">
											<input type="checkbox"  name="ids[]" value="{$value[id]}">
											<span></span>
										</label>
									</td>
									{loop $custom_field_arr $v}
									{if $v=='logo'}
									<td><img src='{$value[logo]}' height='40'></td>
									{else}
									{if $v=='status'}
									<td>

										<label class="css-switch">
											<input type="checkbox" data-field="status" data-id="{$value[id]}" data-size="mini"
												   {if $value[status]}checked{/if} data-on-text="启用" data-off-text="禁用">
											<span></span>
										</label>
									</td>
									{else}
									{if $v=='operation'}
									<td>
										{if in_array('admin/brand/edit',$priv) || empty($priv)}
										<a href="{$edit_url}?id={$value[id]}" class="btnsm-primary">编辑</a>
										{/if}
										{if in_array('admin/brand/delete',$priv) || empty($priv)}
										<a href="{$delete_url}?id={$value[id]}" class="btnsm-danger item-remove">删除</a>
										{/if}
									</td>
									{else}
									<td>{$value[$v]}</td>
									{/if}
									{/if}
									{/if}
									{/loop}
								</tr>
								{/loop}
							</table>
						</div>
					</form>
					 <div class="btn-group dropup" data-act="operateAll">
                            <button class="btnlg mb dropdown-toggle" data-toggle="dropdown" aria-expanded="false" disabled>批量操作<span class="caret"></span></button>
                            <ul class="dropdown-menu" role="menu">
                            	{if in_array('admin/friendlink/delete',$priv) || empty($priv)}
                                <li><a href="#" class="js-deletes">删除</a></li>
                                {/if}                                                    
                                <li><a href="#" class="js-of">禁用</a></li>
                                <li><a href="#" class="js-on">启用</a></li>
                            </ul>
                        </div>
					<div class="text-right">
						{$pagemenu}
					</div>
				</div>
			</div>
		</section>
	</div>
</div>

<!--footer section start-->
{include admin.inc.footer}
<!--footer section end-->

<!--tmpl-script-->
<!--自定义start-->
<script id="defined_table" type="text/html">
	<div>
		<form id="defined_edit" class="form-horizontal">
			<input type="hidden" name="url" value="{$module}/{$action}/{$method}">
			<div class="de_title"><i></i>拖动改变顺序</div>
			<div class="cf">
				<div class="dd" id="nestable3">
					<ol class="dd-list">
						{loop $fields_arr_new $v}
						<li class="dd-item dd3-item" data-id="{$v}">
							<div class="dd-handle dd3-handle"></div><div class="dd3-content">
							<label class="css-checkbox">
								<input type="checkbox" {if in_array($v,$custom_field_arr)}checked="checked"{/if} name="field_arr[]" value="{$v}">
								<span>{$fields_arr[$v]}</span>
							</label>
						</div>
						</li>
						{/loop}
					</ol>
				</div>
			</div>
		</form>
	</div>
</script>
<!--自定义end-->

<script type="text/javascript">
	seajs.use("admin/brand_index",function (parameter){
		parameter.admin_role_assoc_url="{$admin_role_assoc_url}";
		parameter.detailUrl="{$detail_url}";
		parameter.deleteUrl="{$delete_url}";
		parameter.editUrl="{$do_edit_url}";
		parameter.upload_url="{$upload_url}";
		parameter.set_url="/admin/brand/set/";
		parameter.image_search_url="{$image_search_url}";
		parameter.image_list_url="{$image_list_url}";
		parameter.init(parameter);
	});
</script>

<!-- template -->
<script id="editpanel" type="text/html">
</script>
</body>
</html>
